<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css"/>
</head>
<body>
<div class="container">
    <h1>The Goods Page</h1>
    <form>
        <input type="text" name="name">
        <input type="submit" value="查询"/>
        <input type="button" onclick="doLoadGoodsAddUI()" value="添加商品"/>
    </form>

    <table class="table">
        <thead>
        <tr>
            <th>id</th>
            <th>name</th>
            <th>remark</th>
            <th>createdTime</th>
        </tr>0
        </thead>
        <tbody>
        <tr th:each="g:${list}">
            <td th:text="${g.id}">1</td>
            <td th:text="${g.name}">a</td>
            <td th:text="${g.remark}">b</td>
            <td th:text="${#dates.format(g.createdTime, 'yyyy/MM/dd HH:mm')}">2002/1/1</td>
            <td><button th:onclick="doDeleteById([[${g.id}]])">delete</button>
                <button th:onclick="doFindById([[${g.id}]])">update</button> </td>
        </tr>
        </tbody>
    </table>
</div>
<script>
    var rootUrl="http://localhost"
    function doFindById(id){
        location.href=`${rootUrl}/goods/doFindById/${id}`;
    }
    function doLoadGoodsAddUI(){
        location.href=`${rootUrl}/goods/doGoodsAddUI`;
    }
    function  doDeleteById(id){
        location.href=`${rootUrl}/goods/doDeleteById?id=${id}`;
    }
</script>
</body>
</html>